370: Unify nginx config between dev and prod#409
Merged
turegjorup merged 2 commits intoApr 29, 2026
Merged
Conversation
Local dev had its own minimal default.conf.template under .docker/, which lacked the production-only directives (regex static-files location, rate limiting, /health, security headers). That gap is exactly what hid the LiipImagineBundle thumbnail 404 from local testing. Move all dev compose files to mount the same templates/nginx.conf shipped in the production nginx image, parameterize the web root via NGINX_WEB_ROOT (prod default set in the Dockerfile), and delete the redundant .docker/ copies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from
feature/370-fix-thumbnail-404
to
feature/update-infrastructure-for-mono-repo
April 28, 2026 11:58
tuj
approved these changes
Apr 29, 2026
…r-mono-repo' into feature/370-unify-nginx-config # Conflicts: # CHANGELOG.md
turegjorup
merged commit Apr 29, 2026
c6057f3
into
feature/update-infrastructure-for-mono-repo
18 checks passed
turegjorup
added a commit
that referenced
this pull request
Apr 29, 2026
After PR #409 unified the dev and prod nginx templates, the dev compose stack also consumes the production template — but it still passed NGINX_FPM_SERVICE as a combined 'host:port' string. With the template change in this PR ('server ${NGINX_FPM_SERVICE}:${NGINX_FPM_PORT};'), that produced a malformed 'display-phpfpm-1:9000:9000' upstream and nginx failed to start, breaking the Playwright CI run. Split the value in both docker-compose.yml and docker-compose.server.yml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #408. Refs #370.
Why
Local dev has historically used its own minimal nginx config under
.docker/templates/and.docker/nginx.conf, while the production image ships a much fuller config underinfrastructure/nginx/etc/. The split is exactly what hid the LiipImagineBundle thumbnail 404 (#370) from local testing — dev'slocation /always wins for everything, so the production-only regex static-file block that broke things never ran locally.What
root /var/www/html/public→root ${NGINX_WEB_ROOT}.NGINX_WEB_ROOT=/var/www/html/publicto the production nginx Dockerfile so the deployed image's behavior is unchanged.docker-compose.ymlanddocker-compose.server.ymlto mount./infrastructure/nginx/etc/templatesand./infrastructure/nginx/etc/nginx.confinstead of the dev-only copies, and to setNGINX_WEB_ROOT=/app/publicplusNGINX_SET_REAL_IP_FROM=172.16.0.0/12..docker/templates/default.conf.templateand.docker/nginx.conf— single source of truth.Tradeoff
Dev now inherits production-tuned defaults — rate limiting (
limit_req zone=php_limit), immutable cache headers, stricter location matching, security headers. If any of those become a footgun for local iteration, the right fix is to make it env-driven in the shared template (e.g., aNGINX_RATE_LIMIT_BURSTknob) rather than to fork the file again.Test plan
docker compose up nginx phpfpmstarts cleanly;curl -I http://localhost:8080/healthreturns200 healthy./media/cache/resolve/...URL — thumbnail generation works (would have 404'd before 370: Fix thumbnail 404 regression in nginx static-file location #408 even with this PR's mount changes).NGINX_WEB_ROOTdefault kicks in).🤖 Generated with Claude Code